package com.glorysoft.hlgdpda.ui.materialandtool.view

import android.os.Bundle
import com.glorysoft.hlgdpda.BR
import com.glorysoft.hlgdpda.R
import com.glorysoft.hlgdpda.base.BaseActivity
import com.glorysoft.hlgdpda.databinding.ActivityBankUpBinding
import com.glorysoft.hlgdpda.entity.ui.ToastMessageBean
import com.glorysoft.hlgdpda.ui.materialandtool.viewmodel.MaterialViewModel
import kotlinx.android.synthetic.main.activity_bank_up.*

/**
 * FileName: BankUpActivity
 * Author: XJH
 * Date: 2021/5/17 11:52
 * Description:
 * History:
 */
class BankUpActivity : BaseActivity<MaterialViewModel, ActivityBankUpBinding>() {
    override fun layoutId(): Int {
        return R.layout.activity_bank_up
    }

    override fun initVariableId(): Int {
        return BR.materialViewModel
    }

    override fun initView(savedInstanceState: Bundle?) {
        setTitle("Bank库上料")
        setRightListener("上料"){
            if (viewModel.lotID.isEmpty() || viewModel.WarehouseID.isEmpty()){
                viewModel.defUI.toastEvent.value = ToastMessageBean("批次号或Bank库位不能为空",false)
                return@setRightListener
            }
            viewModel.bankShip("SHIP")
        }

        viewModel.defUI.callObserve.observe(this){
            viewModel.defUI.toastEvent.value = ToastMessageBean("Bank库上料成功",true)
            tvCarrier.text = ""
        }
    }

    override fun initData() {

    }
}